/************************************************************************
 * @file GuiPlugin.h
 * @author Ian Chen
 * @version 1.0
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details at
 * http://www.gnu.org/licenses/lgpl.html
 *
 ************************************************************************/
#ifndef GUIPLUGIN_H
#define GUIPLUGIN_H

#include <pluginui/pluginui_global.h>
#include <plugin/plugin/AbstractPlugin.h>

using namespace antu::plugin;

namespace antu
{
namespace plugin
{
namespace ui
{
class AbstractMenuManager;
class AbstractPanelManager;
class AbstractStatusBarManager;
class AbstractToolBarManager;
class AbstractExtension;
class ConfigPanelManager;

/**
 * @brief The GuiPlugin class
 *
 * This is a convenient class used for plugins with UI
 * components. Plugins can inherit this class to populate
 * its own UI widgets.
 */
class PLUGINUISHARED_EXPORT GuiPlugin : public AbstractPlugin
{
    Q_OBJECT

protected:
    AbstractExtension* m_pExtension;

public:
    GuiPlugin(PluginDescriptionSharedPtr pDescription, ServiceRegistry* pServiceRegistry);
    ~GuiPlugin();

    void setExtension(AbstractExtension* pExtension);

    /**
     * @brief Initializes plugin menus.
     * @param pMenuManager Menu manager used to add in menu items.
     */
    void initMenu(AbstractMenuManager* pMenuManager);

    /**
     * @brief Initializes tool bar items.
     * @param pToolBarManager Tool bar manager used to add tool bar elements.
     */
    void initToolBar(AbstractToolBarManager* pToolBarManager);
    void initContentPanel(AbstractPanelManager* pContentPanelManager);
    void initSidePanel(AbstractPanelManager* pSidePanelManager);
    void initStatusBar(AbstractStatusBarManager* pStatusBarManager);
    void initConfigPanels(ConfigPanelManager* pConfigPanelManager);

    void startMenu(AbstractMenuManager* pMenuManager);
    void startToolBar(AbstractToolBarManager* pToolBarManager);
    void startContentPanel(AbstractPanelManager* pContentPanelManager);
    void startStatusBar(AbstractStatusBarManager* pStatusBarManager);
    void startSidePanel(AbstractPanelManager* pSidePanelManager);
    void startConfigPanels(ConfigPanelManager* pConfigPanelManager);

protected:

    virtual void doInit(PluginContext* pContext);
    virtual void doStart();
    virtual void doStop();
    virtual void doFinishStartup();

    virtual void doInitMenu(AbstractMenuManager* pMenuManager);
    virtual void doInitToolBar(AbstractToolBarManager* pToolBarManager);
    virtual void doInitContentPanel(AbstractPanelManager* pContentPanelManager);
    virtual void doInitSidePanel(AbstractPanelManager* pSidePanelManager);
    virtual void doInitStatusBar(AbstractStatusBarManager* pStatusBarManager);
    virtual void doInitConfigPanels(ConfigPanelManager* pConfigPanelManager);

    virtual void doStartMenu(AbstractMenuManager* pMenuManager);
    virtual void doStartToolBar(AbstractToolBarManager* pToolBarManager);
    virtual void doStartContentPanel(AbstractPanelManager* pContentPanelManager);
    virtual void doStartSidePanel(AbstractPanelManager* pSidePanelManager);
    virtual void doStartStatusBar(AbstractStatusBarManager* pStatusBarManager);
    virtual void doStartConfigPanels(ConfigPanelManager* pConfigPanelManager);
};
}
}
}

#endif // GUIPLUGIN_H
